-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frontend: fix load env behavior #1478
Conversation
33d2da4
to
c999ced
Compare
c999ced
to
c2f5cb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job @malinskibeniamin
define: publicVars, | ||
define: { | ||
...publicVars, | ||
'process.env': JSON.stringify(rawPublicVars), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be filtered by REACT_APP_
variables? just making sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have REACT_APP
prefix yes, this basically ensures we have the same behavior as CRA does with https://github.com/facebook/create-react-app/blob/dd420a6d25d037decd7b81175626dfca817437ff/packages/react-scripts/config/env.js#L101-L107
rspack has different behavior compared to webpack when it comes to environment variables.
This has not been an issue in the case of cloud and admin UIs because we don't add more variables later on, everything is within
.env
fileHow CRA does it:
https://github.com/facebook/create-react-app/blob/dd420a6d25d037decd7b81175626dfca817437ff/packages/react-scripts/config/env.js#L101-L107
New docs (latest Rspack release)
web-infra-dev/rsbuild#3718 (issue)
https://github.com/web-infra-dev/rsbuild/pull/3734/files (new docs)
https://rsbuild.dev/guide/migration/cra#env-variables
https://rsbuild.dev/guide/advanced/env-vars#processenv-replacement
BEFORE
AFTER